package com.zz.spring6;


import org.junit.jupiter.api.Test;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestUser {

    private String name;
    private Person person;

    private Logger logger = LoggerFactory.getLogger(TestUser.class);

    @Test
    public void testUserPbject(){
        // 加载配置文件
        ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");


        // 创建对象
        User user = (User) context.getBean("user");
        System.out.println("1" + user);

        System.out.println("2");
        System.out.println(user);
        // 对象调用方法测试
        user.add();

        logger.info("## 执行调用成功了...");
    }

    @Test
    public void testUserPbject1() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
        Class clazz = Class.forName("com.zz.spring6.User");
        User user = (User) clazz.newInstance();
        System.out.println(user);


    }
}
